import { sm4utils } from "./sm-crypto/sm4/smutils";
export default {
	encryptData_ECB(stringKey, data) {
		//加密
		let sm4 = new sm4utils(stringKey);
		let result = sm4.encryptData_ECB(data);
		return result;
	},
	decryptData_ECB(stringKey, data) {
		//解密
		let sm4 = new sm4utils(stringKey);
		let result = sm4.decryptData_ECB(data);
		return result;
	},

	randomString(length) {
		//随机数
		let str = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
		let result = "";
		for (let i = length; i > 0; --i) result += str[Math.floor(Math.random() * str.length)];
		return result;
	}
};
